/**
 * PartB.java
 *
 * 1. Create a dog class. Specify size, breed, and name of dog (variables).
 *    Add a method bark to class dog that will print out “Ruff! Ruff!”
 *    Creater a tester class that instantiates an object d for class dog. 
 *    Set the size of d to 40.
 *    Call the method bark()
 * 
 * 2. Next make the variables private. Try to compile and run the program
 * 
 * 3. Add get and set method to access the private variables.
 *    Submit all programs using the file attachment provided.
 *
 * @author: John Thomason
 *    Date: Nov 13, 2008 / 7:25:24 AM
 *   Class: CIS252 - Introduction to Java Programming
 */


/**
 * Driver class for Dog class testing
 * PartB Class
 */
public class PartB {

  /**
   * Application Entry Point
   * @param args The command line arguments
   */
  public static void main(String[] args) {
    
    //New Dog
    Dog d = new Dog(40);
    
    //Required bark() call
    d.bark();
    
    //A little extra
    prt(d.toString());
    
    //New Dog
    Dog d2 = new Dog(10, "Fifi", "Poodle");
    d2.setBarkTone("Le'Bark! Le'Bark!");
    prt(d2.toString());
    
  }//end main()
  
  /**
   * Display a formatted message string
   * @param msg The formatted message string
   */
  protected static void prt(String msg){
    System.out.print(msg);
  }//prt()

}//end PartB class


class Dog {
  
  //Instance Variables
  private Integer size;
  private String  breed, name;
  private String  barkTone = "Ruff! Ruff!";
  
  //Constructors
  public Dog(){
    this(25);
  }
  public Dog(Integer size){
    this(size, "Dog");
  }
  public Dog(Integer size, String name){
    this(size, name, "Mutt");
  }
  public Dog(Integer size, String name, String breed){
    setSize(size);
    setName(name);
    setBreed(breed);
  }//Dog()
  
  
  //Accessors
  public Integer getSize(){
    return size;
  }//getSize()
  
  public String getName(){
    return name; 
  }//getName()
  
  public String getBreed(){
    return breed;
  }//getBreed()
  
  public String getBarkTone(){
    return barkTone;
  }//barkTone()
  
  
  //Mutators
  public void setSize(Integer size){
    this.size = size;
  }//setSize()
  
  public void setName(String name){
    this.name = name;
  }//setName()
  
  public void setBreed(String breed){
    this.breed = breed;
  }//setBreed()
  
  public void setBarkTone(String barkTone){
    this.barkTone = barkTone;
  }//setBarkTone()
  
  
  //Other public methods
  public void bark(){
    bark(getBarkTone());
  }
  public void bark(String barkTone){
    PartB.prt(barkTone + "\n");
  }//bark()

  @Override
  public String toString(){
    return String.format("\n%s (That's Hi! in %s lingo)\n" +
                         "My name is \"%s\", " +
                         "and I weigh %s pounds.\n\n",
                          getBarkTone(),
                          getBreed(),
                          getName(),
                          getSize());
  }//toString()
  
}//Dog class


